package com.aimei.core.moduel.util;

import com.aimei.www.modules.exception.ExceptionBase;

/**
 * @author xiah
 * @date 2018/5/2 18:27
 */
public class TokenUtil {
       /**
        * @author xiah
        * description: 该方法用来截取token
        * param:
        * return:
        * date: 2018/5/2
        */
       public static String interceptToken(String token) throws Exception {
              if ( token == null || token.length() < 7 || (!token.toLowerCase().startsWith("barear "))
                      ) {
                     /*抛出token错误异常，后期处理*/
                     throw new ExceptionBase(122, "phoneNumber is wrong");
              }
              String to = token.substring(7);
              return to;
       }
}
